<?php $this->widget('zii.widgets.grid.CGridView', array(
    'id'=>'branch-grid',
    'dataProvider'=>$dataProvider,
    'filter'=>$model,
    'ajaxUpdate'=> TRUE,
    //'template' => "{items} {pager}",
    'itemsCssClass' => 'table table-striped table-bordered',
    'pagerCssClass' => 'pagination pagination-centered',
    'pager'=>array(
        'class'=>'CLinkPager',
        'htmlOptions' => array(
            'class' => '',
        ),
        'hiddenPageCssClass' => 'disabled',
        'selectedPageCssClass' => 'active',
        'maxButtonCount'    =>  8,
        'header'            => FALSE,

    ),
    'loadingCssClass' => '',
    'beforeAjaxUpdate'=>'function(id,options){
        $("#ajax-loading").fadeIn();    
    }',
    'afterAjaxUpdate'=>'function(id,options){
        $("#ajax-loading").fadeOut();    
    }',
    'columns'=>array(
      array(
        'header'=>'No.',
        'value'=>'$this->grid->dataProvider->pagination->currentPage * $this->grid->dataProvider->pagination->pageSize + ($row+1)',
      ),
        array(
            'name' => 'id',
            'type'      =>  'html',
            'value' => '$data->id',
            'headerHtmlOptions' => array('style' => 'width: 40px'),
        ),
        array(
            'name' => 'image',
            'type'      =>  'html',
            'value' => 'CHtml::image($data->getImageUrl("80"))',
            'filter' => FALSE,
        ),
        array(
            'name' => 'name',
            'type'      =>  'html',
            'value' => '"<div>".$data->name."</div><div class=\"grid-address-full\">".$data->siblingLabelList."</div>"',
        ),
        array(
            'name' => 'cats',
            'type'      =>  'raw',
            'value' => '$data->catLabelList',
            'filter' => PostCat::model()->data,
        ),
        array(
            'name' => 'city_id',
            'type'      =>  'raw',
            'value' => '$data->city->name',
            'filter' => City::model()->data,
        ),
        array(
            'name' => 'district_id',
            'type'      =>  'raw',
            'value' => '$data->district->name',
            'filter' => $districtsData,
        ),
        array(
            'name' => 'publicLocations',
            'type'      =>  'raw',
            'value' => '$data->publicLocationLabelList',
            'filter' => $locationData,
        ),
        array(
            'name' => 'address',
            'type'      =>  'html',
            'value' => '$data->address',
        ),

        array(
            'header' => 'Comment',
            'name' => 'comment_count',
            'type'      =>  'html',      
            'value' => '$data->comment_count ? CHtml::link($data->comment_count, Yii::app()->createUrl("/admin/comment", array("Comment[branch_id]" => $data->id)), array("class" => "badge")) : ""',
            'filter' => array(
                '1' => 'Có',
                '0' => 'Ko có',
            ),
        ),
        
        array(
            'header' => 'Event',
            'name' => 'event_count',
            'type'      =>  'html',
            'value' => '$data->event_count ? CHtml::link($data->event_count, Yii::app()->createUrl("/admin/event", array("Event[branch_id]" => $data->id)), array("class" => "badge")) : ""',
            'filter' => array(
                '1' => 'Có',
                '0' => 'Ko có',
            ),
        ),
        array(
            'header' => 'Món',
            'name' => 'item_count',
            'type'      =>  'html',
            'value' => '$data->item_count ? CHtml::link($data->item_count, Yii::app()->createUrl("/admin/item", array("Item[branch_id]" => $data->id)), array("class" => "badge")) : ""',
            'filter' => array(
                '1' => 'Có',
                '0' => 'Ko có',
            ),
        ),
        array(
            'header' => 'Số ảnh',
            'name' => 'image_count',
            'type'      =>  'raw',
            'value' => '$data->image_count',
        ),
        array(
            'name' => 'status',
            'type'      =>  'raw',
            'value' => '$data->statusLabel',
            'filter' => $model->statusData,
        ),
        array(
            'header' => 'Ghi chú',
            'name' => 'has_note',
            'type'      =>  'html',
            'value' => '$data->has_note ? "<i class=\"icon-pencil\"></i>" : ""',
            'filter' => array(
                '1' => 'Có',
                '0' => 'Ko có',
            ),
        ),
        array(
            'header' => 'Cần ảnh',
            'name' => 'need_img',
            'type'      =>  'html',
            'value' => '$data->need_img ? "<i class=\"icon-picture\"></i>" : ""',
            'filter' => array(
                '1' => 'Cần',
                '0' => 'Ko cần',
            ),
        ),
        array(
            'header' => 'Cần info',
            'name' => 'need_info',
            'type'      =>  'html',
            'value' => '$data->need_info ? "<i class=\"icon-info-sign\"></i>" : ""',
            'filter' => array(
                '1' => 'Cần',
                '0' => 'Ko cần',
            ),
        ),
        array(
            'class'=>'CButtonColumn',
            'template'=>'{update}',
        ),
    ),
)); ?>             